<%-- 
    Document   : loans
    Created on : Apr 27, 2012, 12:20:04 PM
    Author     : Jayson Kiong
--%>

<%@page import="javax.swing.text.html.Option"%>
<%@page import="Model.Loan"%>
<%@page import="Model.Agent"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Model.User"%>
<%@page import="Model.Types"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
        <title>Loans</title>
        <script type="text/javascript" src ="datepicker.js"></script>
        <link rel = "stylesheet" type = "text/css" href = "quicklendstyle.css"/>
        <link rel="stylesheet" type="text/css" href="css/jquery.datepick.css" id="theme">
        <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
        <script type="text/javascript" src="js/jquery.datepick.js"></script>
        <script type="text/javascript" src="quicklendjs.js"></script>
        
        
	<script type="text/javascript">
		$(function(){

			// Accordion
			$("#accordion").accordion({ header: "h3" });
                        
                        // Accordion
			$("#accordion2").accordion2({ header: "h3" });

			// Tabs
			$('#tabs').tabs();

			// Dialog
			$('#dialog').dialog({
				autoOpen: false,
				width: 600,
				buttons: {
					"Ok": function() {
						$(this).dialog("close");
					},
					"Cancel": function() {
						$(this).dialog("close");
					}
				}
			});
				// Dialog Link
			$('#dialog_link').click(function(){
				$('#dialog').dialog('open');
				return false;
			});
				// Datepicker
			$('#datepicker').datepicker({
				inline: true
			});
				// Slider
			$('#slider').slider({
				range: true,
				values: [17, 67]
			});
				// Progressbar
			$("#progressbar").progressbar({
				value: 20
			});
				//hover states on the static widgets
			$('#dialog_link, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); },
				function() { $(this).removeClass('ui-state-hover'); }
			);
			});
                        
                          
	</script>
	<style type="text/css">
			/*demo page css*/
		body{ font: 62.5% "Segoe UI", sans-serif; margin: 50px;}
		.demoHeaders { margin-top: 2em; }
		#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
		#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
		ul#icons {margin: 0; padding: 0;}
		ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
		ul#icons span.ui-icon {float: left; margin: 0 4px;}
	</style>
        
       
        <script type="text/javascript">
            $(function(){
             $('#daterelease').datepick();
             $('#checkdate').datepick();
             $('#borrowerbirthday').datepick();
             $('#comakerbirthday').datepick();
             $("#loandate").datepick();
             $("#releasedate").datepick();
             $("#collectdate").datepick();
             $("#datereleased").datepick();
             $("#unofficialrelease").datepick();
             $("#unofficialcollect").datepick();
             $("#checkdate2").datepick();
             $("#fromdate").datepick();
             $("#todate").datepick();
              });
        </script>

    </head>
    <body>
        <%ArrayList typear = (ArrayList)session.getAttribute("types");
          ArrayList bankar = (ArrayList)session.getAttribute("bankname");
          ArrayList agentar = (ArrayList)session.getAttribute("agent");
          ArrayList loanar = (ArrayList)session.getAttribute("loan");
          int j=0,arctr=0;
          Types type = new Types();
          Agent agent = new Agent();
          Loan loan = new Loan();
          String bankname = "";
          int typearsize = typear.size();
          int bankarsize = bankar.size();
          int agentarsize = agentar.size();
          int loanarsize = loanar.size();
          
        %>
        
        <div id="tabs" style="position:absolute;width:850px;height:580px;top:10px;left:20px; border:none;">
		<ul>
                    <li><a href="#tabs-1">Create Loan Entry</a></li>
                    <li><a href="#tabs-2">Loan Entry Record</a></li>
				
		</ul>
		<div id="tabs-1">
                    <form id="loanentryform" name="loanentryform" action="Createloan" method="POST">
                    <div id="createloanno" style="position:absolute; top: 68px; left:25px;">
                        Loan No. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" style="width:130px;height:15px;font-weight:600;color:#009900"></input>     
                    </div>
                    <div id="type" style="position:absolute; top:100px; left:25px;">
                        Client Type:  &nbsp;&nbsp;  <select name="clienttype" style="width:135px">
                                                        <%for(int x=0;x<typearsize;x++){
                                                        type=(Types)typear.get(arctr); 
                                                        if(type.getStrType().equals("Client")){
                                                        %>
                                                        <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                                        <%}%>   
                                                        <%arctr++;}%> 
                                                    </select>   
                        </br>
                        Sub Type:   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     <select name="subtype"style="width:135px">
                                                                        <%arctr=0;
                                                                        for(int x=0;x<typearsize;x++){
                                                                        type=(Types)typear.get(arctr); 
                                                                        if(type.getStrType().equals("Sub")){
                                                                        %>
                                                                        <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                                                        <%}%>   
                                                                        <%arctr++;}%>
                                                                       </select>
                        </br>
                        Loan Type:    &nbsp;&nbsp;&nbsp;     <select name="loantype" style="width:135px">
                                                                <%arctr=0;
                                                                for(int x=0;x<typearsize;x++){
                                                                type=(Types)typear.get(arctr); 
                                                                if(type.getStrType().equals("Loan")){
                                                                %>
                                                                <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                                                <%}%>   
                                                                <%arctr++;}%>
                                                             </select>
                    </div>

                    <div id="loandetails" style="position:absolute; top: 190px; left:25px;">
                        PN/Month:&nbsp;&nbsp;&nbsp; <input type="text" name="pnmonth" style="top:50px;width:130px;height:18px;font-family: Segoe UI; font-weight: bold; font-size:16px;text-align:right;" onKeyPress="validate(event)"></input><br style="line-height:30px;"/>

                        Term:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <select name="term" style="top:50px;width:130px;height:24px;font-family: Segoe UI; font-weight: bold; font-size:16px;text-align:right;" onKeyPress="validate(event)">
                                                                                                <% for (int i=1;i<=60;i++){
                                                                                                    j=i*6;%>
                                                                                                 
                                                                                                    <option value="<%=j%>"><%=j%></option>
                                                                                                <%}%>
                                                                                                
                                                                                                </select>
                    </div>

                    <div id="releaseinfohead" style="position:absolute; top:265px; left:23px; width:160px; font-weight:600; font-size:16px;">
                          Release Information
                    </div>
                    
                    <div id="releaseinformation" style="position:absolute; top:305px;left:25px; font-family: Segoe UI; font-size:14px;">
                        Date Released: &nbsp;&nbsp;&nbsp;
                        <input id="daterelease" name="daterelease" style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        Check Date: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="checkdate" name="checkdate" type="text" style="width:130px;height:15px;font-family:Segoe UI;"></input><br style="line-height:25px;"/>

                        Check Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="text" name="checkname" style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        
                        Check No: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="text" name="checkno" style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        
                        Bank Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <select name="bankname" style="width:135px;font-family:Segoe UI;">
                               <%arctr=0;
                               for(int x=0;x<bankarsize;x++){
                               bankname=(String)bankar.get(arctr);%>
                               <option value="<%=bankname%>"><%=bankname%></option> 
                               <%arctr++;}%>
                        </select><br style="line-height:25px;"/>
                        Unofficial Release Date: &nbsp;
                        <input id="unofficialrelease" name="unreleasedate" style="width:110px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        Unofficial Collect Date: &nbsp;&nbsp;
                        <input id="unofficialcollect" name="uncollectdate" style="width:110px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        
                        Collection Date: &nbsp;
                        <input id="collectdate" name="collectdate" style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        Loan Date: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="loandate" name="loandate" style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                        Release Date: &nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="releasedate" name="releasedate"style="width:130px;height:15px;font-family:Segoe UI;"><br style="line-height:25px;"/>
                    </div>
                    
                    <div id="accordion2" style="font-size:12px;position: absolute; top:60px; left:306px; width:548px ; height:550px">
                        <div>
                            <h3><a href="#">Borrower Details</a></h3>
                            <div>
                                <div id="borroweraccountno" style="position:absolute; top:20px; left:10px; font-family:Segoe UI; font-weight:bold;">
                                    Account No. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" style="width:130px;height:15px;font-weight:600;color:#009900"></input>     
                                </div>
                                
                                <div id="unitcode"style="position:absolute; top:20px; left:295px; font-family:Segoe UI; font-size:14px;">
                                    Unit Code:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" style="width:130px;height:15px;"></input>
                                </div>
                                
                                <div id="borrowername" style="position:absolute; top:60px; left:10px; font-family:Segoe UI;">
                                    Last Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="lastname" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="status" style="width:130px;height:15px;">     
                                    </br>
                                    </br>
                                    First Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="firstname" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rank: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="rank" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    Middle Name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="middlename" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Service: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="service" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    No. & Street: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="street" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Birthday: &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input id="borrowerbirthday" name="bday" style="width:130px;height:15px;font-family:Segoe UI;">
                                    
                                    </br>
                                    </br>
                                    Town/City/Province:&nbsp;&nbsp;&nbsp;<input type="text" name="city" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Children:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="children" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    Address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="address" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Spouse:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="spouse" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    Zip:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="zip" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact No.&nbsp;&nbsp;<input type="text" name="contact" style="width:130px;height:15px;">
                                    
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <h3><a href="#">Co-Maker Details</a></h3>
                            <div>
                               
                                    <div id="borrowername" style="position:absolute; top:60px; left:10px; font-family:Segoe UI;">
                                        Last Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_lastname" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_status" style="width:130px;height:15px;">     
                                    </br>
                                    </br>
                                    First Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_firstname" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Children: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_children" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    Middle Name:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_middlename" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_contact" style="width:130px;height:15px;">          
                                    </br>
                                    </br>
                                    No. & Street: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_street" style="width:130px;height:15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Birthday: &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input id="comakerbirthday" name="c_bday" style="width:130px;height:15px;font-family:Segoe UI;">
                                    
                                    </br>
                                    </br>
                                    Town/City/Province:&nbsp;&nbsp;&nbsp;<input type="text" name="c_city" style="width:130px;height:15px;">         
                                    </br>
                                    </br>
                                    Address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_address" style="width:130px;height:15px;">
                                    </br>
                                    </br>
                                    Zip:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="c_zip" style="width:130px;height:15px;">
                                  </div>
                            </div>
                        </div>
                        
                        <div>
                            <h3><a href="#">Agent Details</a></h3>
                            <div>
                                <div id="agentcode" style="position:absolute; top:20px; left:10px; font-family:Segoe UI; font-weight:bold;">
                                    <%agent = (Agent)agentar.get(0);%>
                                    Agent Code: &nbsp;&nbsp;&nbsp;&nbsp;<input name="agentcode" value="<%=agent.getStrAgentcode()%>" type="text" style="width:130px;height:20px;font-weight:600;color:#009900"></input> 
                                    </br>
                                    </br>
                                    </br>
                                    Agent Name: &nbsp;&nbsp;&nbsp;
                                    <select name="agentname" style="width:160px;height:25px;" onchange="updateAgentCode()">
                                        <%arctr=0;
                                        for(int x=0;x<agentarsize;x++){
                                        agent=(Agent)agentar.get(arctr);%>
                                        <option value="<%=agent.getStrName()%>"><%=agent.getStrName()%></option> 
                                        <%arctr++;}%>
                                    </select>
                                    
                                    <select name="hiddenagentcode" style="display:none;">
                                        <%arctr=0;
                                        for(int x=0;x<agentarsize;x++){
                                        agent=(Agent)agentar.get(arctr);%>
                                        <option value="<%=agent.getStrAgentcode()%>"><%=agent.getStrAgentcode()%></option> 
                                        <%arctr++;}%>
                                    </select>
                                    
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div id ="loansbtn" style="position:absolute; top:540px; left:500px;">
                        <input type="image" src="images/saveimage.png"  size="13" style="position:absolute; left:0px"/></a>
                        <a href="#" class="precompcancelbtn" name="cancelbtn"  size="13" style="position:absolute; left:170px"/></a>
                    </div>    
                    </form>
                </div>
        
		<div id="tabs-2">
                    
                  <!--  <div id="tablesearch" style="position:absolute; top:60px; left:24px;font-family:Segoe UI;font-size:14px;">
                        Quick Search:&nbsp;&nbsp;<select name="quicksearch" style="height:25px;font-family:Segoe UI;">
                                                    <option value="NEW">NEW</option>
                                                    <option value="DELINQUENT">DELINQUENT</option>
                                                    <option value="GOOD">GOOD</option>
                                                </select>
                        <input type="text" style="width:130px;"></input>
                        <button id="searchbtn">Search</button>
                        From:&nbsp;&nbsp;<input id="fromdate" type="text" style="width:130px;height:15px;">&nbsp;&nbsp;To:&nbsp;&nbsp;<input id="todate" type="text" style="width:130px;height:15px;">
                    </div!-->
                    <div id="typetable" style="position:absolute; top:110px; left:24px; overflow: auto; width: 800px; height: 300;  padding:0px; margin: 0px">
                        <table border="1" cellspacing=0 cellpadding=2 style="height:120px">
                        <tr>
                            
                            <th width=250 bgcolor="lightgrey">Client Name</th>
                            <th width=250 bgcolor="lightgrey">Term No.</th>
                            <th width=230 bgcolor="lightgrey">Loan Amount</th>
                            <th width=250 bgcolor="lightgrey">Loan Date</th>
                            <th width=250 bgcolor="lightgrey">Collect Date</th>
                            <th width=250 bgcolor="lightgrey">Release Date</th>
                            <th width=250 bgcolor="lightgrey">Unofficial Release Date</th>
                            <th width=250 bgcolor="lightgrey">Unofficial Collect Date</th>
                            <th width=250 bgcolor="lightgrey">Date Released</th>
                            <th width=250 bgcolor="lightgrey">Check Date</th>
                            <th width=250 bgcolor="lightgrey">Bank Name</th>
                            <th width=250 bgcolor="lightgrey">Check Name</th>
                            <th width=250 bgcolor="lightgrey">Check No.</th>
                            <th width=250 bgcolor="lightgrey">Status</th>
                            <th width=250 bgcolor="lightgrey">Paid</th>
                            
                            
                        </tr>
                        <%arctr=0;
                        
                          for(int x=0;x<loanarsize;x++){
                          loan=(Loan)loanar.get(arctr); 
                           %>
                          <tr><td style="display:none"><%=loan.getiLoanid()%></td><td><%=loan.getStrClientName()%></td><td><%=loan.getiTermsid()%></td><td><%=loan.getfLoanamount()%></td><td><%=loan.getStrLoandate()%></td><td><%=loan.getStrCollectdate()%></td><td><%=loan.getStrReleasedate()%></td><td><%=loan.getStrUnreleasedate()%></td><td><%=loan.getStrUncollectdate()%></td><td><%=loan.getStrDatereleased()%></td><td><%=loan.getStrCheckdate()%></td><td><%=loan.getStrBankname()%></td><td><%=loan.getStrCheckname()%></td><td><%=loan.getStrCheckno()%></td><td><%=loan.getStrStatus()%></td><td><%=loan.getStrPaid()%></td></tr> 
                          <%arctr++;}%>
                        
                        </table>
                    </div>
                    
                </div>
			
	</div>
    </body>
</html>
